#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void Solve(){
    int n;
    cin>>n;
    map<int,int> mp;
    for(int i=0,x;i<n;i++){
        cin>>x;
        mp[x]++;
    }
    int ans=-1;
    for(auto &[x,y]:mp){
        if(!mp.count(x-1)){
            ans++;
            if(!mp.count(x+1)){
                ans+=y-1;
            }
        }
    }
    cout<<ans<<endl;
    return;
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr); std::cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--)Solve();

    return 0;
}